import countriesData from '@/json/children_json_countries.json'
import citiesData from '@/json/children_json_cities.json'
import statesData from "@/json/children_json_states.json";
export default () => {
  // 城市隶属于哪个国家
  const getCitiesCountry = () => {
    citiesData.RECORDS.forEach(city => {
      statesData.RECORDS.forEach(states => {
        if (city.state_id === states.id) {
          // @ts-ignore
          city.countryId = states.country_id
        }
      })
    })
    citiesData.RECORDS.forEach(city => {
      countriesData.RECORDS.forEach(country => {
        // @ts-ignore
        if (city.countryId === country.id) {
          // @ts-ignore
          city.countryName = country.cname
          // @ts-ignore
          city.countryRemark = country.remark
        }
      });
    })
  }
  getCitiesCountry()
  return {
    citiesData, // 城市
    countriesData // 国家
  }
}
